var app = getApp(),
a = app.requirejs('core');

Page({
    data: {
      show:false,
        total_price: 0,
        price: 0,
        cash_price: 0,
        total_cash: 0,
        team_count: 0,
        order_money: 0
    },

    //底部导航跳转
    menu_url: function (k) {
      a.menu_url(k, 2);
    },
    
  onLoad: function (e) {
    e.title = e.title ? e.title : "分销中心"
    a.ReName(e.title);
    a.setting();

    if (e != null && e != undefined) {
      this.setData({
        tabbar_index: e.tabbar_index ? e.tabbar_index : -1
      });
    }
    this.setData({
      menu: getApp().tabBar,
      class_id: e.id ? e.id : '',
      class_id1: e.id ? e.id : '',
      class_style: e.class_style ? e.class_style : 2
    })

    if (this.data.tabbar_index >= 0) {
      this.setData({
        showtabbar: true,
      })
    }

    var that = this;
    that.getInfo()
  },
  getInfo: function () {
    var that = this;
    a.get('Distribe/shareSetting',{},function(t){
      if(t.code==0){
        app.setCache('shareSetting',t.info);
        that.setData({
          shareSetting:t.info
        })
      }
    })
    a.get('Distribe/userinfo', { uid: app.getCache('userinfo').uid }, function (t) {
      if (t.code == 0) {
        app.setCache('share_userinfo', t.info);
        that.setData({
          user_info: t.info,
          show: true
        })
      } else {
        a.alert(t.msg, function () {
          a.jump('', 5)
        })
      }
    }, true)
  },
    onReady: function() {},
    onShow: function() {
        
    },
   
    onPullDownRefresh: function() {
      var that = this;
      that.getInfo();
      wx.stopPullDownRefresh();
    },
    onReachBottom: function() {},
    apply: function(e) {
      var that=this;
      a.jump('../add-share/index?title=申请'+that.data.shareSetting.other[13])
    },
    home:function(e){
      a.jump('/yb_shop/pages/index/index',3)
    }
});